package com.example.controller;


import com.example.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;


@RestController
public class OrderController {

    @Autowired
    private RestTemplate restTemplate = new RestTemplate();

    @GetMapping("/order/{id}")
    public User getOrder(@PathVariable Long id)
    {
        User user  = restTemplate.getForObject("http://localhost:8001/user/" + id, User.class);
        // User user = new User(id);
        return user;
    }

}
